﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ATSBLL;
using System.IO;
using CrystalDecisions.Web;
using ATSModel;
using System.Collections.Generic;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportAppServer.ClientDoc;

public partial class TestDataReport_TDReport_TDReport : System.Web.UI.Page
{
    private DataSet ds;
    private TTestItem ti; 
    protected void Page_Load(object sender, EventArgs e)
    {
        ti = new TTestItem(); 

    }
    protected void BtuQuery_Click(object sender, EventArgs e)
    {

        string PSN = tbPSN.Value.Trim();
        string Angle = tbAngle.Value.Trim();
        ds = GetTInfo("TTest", PSN, Angle);
        CrystalReportSource.ReportDocument.Load(Server.MapPath("TDReport.rpt"));
        CrystalReportSource.ReportDocument.SetParameterValue("@PSN", PSN);
        CrystalReportSource.ReportDocument.SetParameterValue("@TestAngle", Angle);
        CrystalReportSource.ReportDocument.SetDataSource(ds.Tables[0]);


        ds = ti.GetTDInfo("TTestItem", "TDVSWR", PSN, Angle); 
        ReportDocument suboRpt1 = CrystalReportSource.ReportDocument.OpenSubreport("TDVSWRReport.rpt"); 
        CrystalReportSource.ReportDocument.SetParameterValue("@PSN", PSN);
        CrystalReportSource.ReportDocument.SetParameterValue("@TestAngle", Angle);
        suboRpt1.SetDataSource(ds.Tables[0]);

        ds = ti.GetTDInfo("TTestItem", "TDISOS", PSN, Angle);
        ReportDocument suboRpt2 = CrystalReportSource.ReportDocument.OpenSubreport("TDISOSReport.rpt"); 
        CrystalReportSource.ReportDocument.SetParameterValue("@PSN", PSN);
        CrystalReportSource.ReportDocument.SetParameterValue("@TestAngle", Angle);
        suboRpt2.SetDataSource(ds.Tables[0]);



        ds = ti.GetTDInfo("TTestItem", "TDISOD", PSN, Angle);
        ReportDocument suboRpt3 = CrystalReportSource.ReportDocument.OpenSubreport("TDISODReport.rpt"); 
        CrystalReportSource.ReportDocument.SetParameterValue("@PSN", PSN);
        CrystalReportSource.ReportDocument.SetParameterValue("@TestAngle", Angle);
        suboRpt3.SetDataSource(ds.Tables[0]);


        ds = ti.GetTDInfo("TTestItem", "TDPhase", PSN, Angle); 
        ReportDocument suboRpt4 = CrystalReportSource.ReportDocument.OpenSubreport("TDPhaseReport.rpt"); 
        CrystalReportSource.ReportDocument.SetParameterValue("@PSN", PSN);
        CrystalReportSource.ReportDocument.SetParameterValue("@TestAngle", Angle);
        suboRpt4.SetDataSource(ds.Tables[0]);


        ds = ti.GetTDInfo("TTestItem", "TDMag", PSN, Angle);
        ReportDocument suboRpt5 = CrystalReportSource.ReportDocument.OpenSubreport("TDMagReport.rpt"); 
        CrystalReportSource.ReportDocument.SetParameterValue("@PSN", PSN);
        CrystalReportSource.ReportDocument.SetParameterValue("@TestAngle", Angle);
        suboRpt5.SetDataSource(ds.Tables[0]);



        this.CrystalReportSource.DataBind();
        this.CrystalReportViewer.ReportSource = CrystalReportSource;
        this.CrystalReportViewer.DataBind();
        this.CrystalReportViewer.Visible = true;
    }

    protected DataSet GetTInfo(string TableName, string PSN, string Angle)
    { 
        TTest TT = new TTest();
        ds = TT.GetTDInfo(TableName, PSN, Angle);
        return ds;
    }
     

    //protected IList<TTestItemInfo> GetDataInfo(string Info)
    //{
    
    //    IList<TTestItemInfo> TIInfo = new List<TTestItemInfo>();
    //    TTestItem TI = new TTestItem();  
    //    switch (Info)
    //    {
    //        case "TDVSWR":  //驻波
    //            TIInfo = TI.GetTDInfo("",Info,PSN, Angle);
    //            break;
    //        case "TDISOS": //同频带间隔离
    //            TIInfo = TI.GetTDInfo("",Info,PSN, Angle);
    //            break;
    //        case "TDISOD"://异频带间隔离
    //            TIInfo = TI.GetTDISODTInfo(PSN, Angle); ;
    //            break;
    //        case "TDPhase"://相位
    //            TIInfo = TI.GetTDPhasInfo(PSN, Angle); ;
    //            break;
    //        case "TDMag"://幅度(耦合)
    //            TIInfo = TI.GetTDMagInfo(PSN, Angle); ;
    //            break;  
    //        default: 
    //            break;
    //    }
    //    return TIInfo;
    //} 
 
}
